﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SetNamePanel : BasePanel<SetNamePanel>
{
    public UIInput input;
    public UIButton btnConfirm;

    void Start()
    {
        Hide();
        btnConfirm.onClick.Add(new EventDelegate(OnSubName));
    }

    public void InitName(string name)
    {
        input.value = name;
    }

    public void OnSubName()
    {
        if (input.value.Length <= 0)
        {
            Debug.LogFormat("名字不能为空!");
            return;
        }
        GamePanel.Instance.SetName(input.value);
        GameDataMgr.Instance.playerData.SetName(input.value);
        Hide();
    }
}
